<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>uvgRTP: include/rtcp.hh Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">uvgRTP
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">rtcp.hh</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#pragma once</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160; </div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="preprocessor">#include &lt;bitset&gt;</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="preprocessor">#include &lt;map&gt;</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#include &lt;thread&gt;</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160; </div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#include &quot;clock.hh&quot;</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#include &quot;frame.hh&quot;</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#include &quot;runner.hh&quot;</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#include &quot;socket.hh&quot;</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &quot;srtp/srtcp.hh&quot;</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="util_8hh.html">util.hh</a>&quot;</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160; </div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="keyword">namespace </span>uvgrtp {</div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160; </div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;    <span class="keyword">enum</span> RTCP_ROLE {</div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;        RECEIVER,</div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;        SENDER</div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;    };</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160; </div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;    <span class="comment">/* TODO: explain these constants */</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">int</span> RTP_SEQ_MOD    = 1 &lt;&lt; 16;</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">int</span> MIN_SEQUENTIAL = 2;</div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">int</span> MAX_DROPOUT    = 3000;</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">int</span> MAX_MISORDER   = 100;</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">int</span> MIN_TIMEOUT    = 5000;</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160; </div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;    <span class="keyword">struct </span>rtcp_statistics {</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;        <span class="comment">/* receiver stats */</span></div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;        uint32_t received_pkts;  <span class="comment">/* Number of packets received */</span></div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;        uint32_t dropped_pkts;   <span class="comment">/* Number of dropped RTP packets */</span></div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;        uint32_t received_bytes; <span class="comment">/* Number of bytes received excluding RTP Header */</span></div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160; </div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;        <span class="comment">/* sender stats */</span></div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;        uint32_t sent_pkts;   <span class="comment">/* Number of sent RTP packets */</span></div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;        uint32_t sent_bytes;  <span class="comment">/* Number of sent bytes excluding RTP Header */</span></div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160; </div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;        uint32_t jitter;      <span class="comment">/* TODO: */</span></div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;        uint32_t transit;     <span class="comment">/* TODO: */</span></div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160; </div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;        <span class="comment">/* Receiver clock related stuff */</span></div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;        uint64_t initial_ntp; <span class="comment">/* Wallclock reading when the first RTP packet was received */</span></div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;        uint32_t initial_rtp; <span class="comment">/* RTP timestamp of the first RTP packet received */</span></div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;        uint32_t clock_rate;  <span class="comment">/* Rate of the clock (used for jitter calculations) */</span></div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160; </div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;        uint32_t lsr;                     <span class="comment">/* Middle 32 bits of the 64-bit NTP timestamp of previous SR */</span></div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;        uvgrtp::clock::hrc::hrc_t sr_ts; <span class="comment">/* When the last SR was received (used to calculate delay) */</span></div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160; </div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;        uint16_t max_seq;  <span class="comment">/* Highest sequence number received */</span></div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;        uint16_t base_seq; <span class="comment">/* First sequence number received */</span></div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;        uint16_t bad_seq;  <span class="comment">/* TODO:  */</span></div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;        uint16_t cycles;   <span class="comment">/* Number of sequence cycles */</span></div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;    };</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160; </div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;    <span class="keyword">struct </span>rtcp_participant {</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;        uvgrtp::socket *socket; <span class="comment">/* socket associated with this participant */</span></div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;        sockaddr_in address;     <span class="comment">/* address of the participant */</span></div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;        <span class="keyword">struct </span>rtcp_statistics stats; <span class="comment">/* RTCP session statistics of the participant */</span></div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160; </div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;        <span class="keywordtype">int</span> probation;           <span class="comment">/* has the participant been fully accepted to the session */</span></div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;        <span class="keywordtype">int</span> role;                <span class="comment">/* is the participant a sender or a receiver */</span></div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160; </div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;        <span class="comment">/* Save the latest RTCP packets received from this participant</span></div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;<span class="comment">         * Users can query these packets using the SSRC of participant */</span></div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;        uvgrtp::frame::rtcp_sender_report   *s_frame;</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;        uvgrtp::frame::rtcp_receiver_report *r_frame;</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;        uvgrtp::frame::rtcp_sdes_packet     *sdes_frame;</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;        uvgrtp::frame::rtcp_app_packet      *app_frame;</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;    };</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160; </div>
<div class="line"><a name="l00074"></a><span class="lineno"><a class="line" href="classuvgrtp_1_1rtcp.html">   74</a></span>&#160;    <span class="keyword">class </span><a class="code" href="classuvgrtp_1_1rtcp.html">rtcp</a> : <span class="keyword">public</span> runner {</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;        <span class="keyword">public</span>:</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;            <a class="code" href="classuvgrtp_1_1rtcp.html">rtcp</a>(uvgrtp::rtp *rtp, <span class="keywordtype">int</span> flags);</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;            <a class="code" href="classuvgrtp_1_1rtcp.html">rtcp</a>(uvgrtp::rtp *rtp, uvgrtp::srtcp *srtcp, <span class="keywordtype">int</span> flags);</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;            ~<a class="code" href="classuvgrtp_1_1rtcp.html">rtcp</a>();</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160; </div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;            <span class="comment">/* start the RTCP runner thread</span></div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;<span class="comment">             *</span></div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;<span class="comment">             * return RTP_OK on success and RTP_MEMORY_ERROR if the allocation fails */</span></div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;            rtp_error_t start();</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160; </div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;            <span class="comment">/* End the RTCP session and send RTCP BYE to all participants</span></div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;<span class="comment">             *</span></div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;<span class="comment">             * return RTP_OK on success */</span></div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;            rtp_error_t stop();</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160; </div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;            <span class="comment">/* Generate either RTCP Sender or Receiver report and sent it to all participants</span></div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;<span class="comment">             * Return RTP_OK on success and RTP_ERROR on error */</span></div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;            rtp_error_t generate_report();</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160; </div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;            <span class="comment">/* Handle different kinds of incoming packets</span></div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;<span class="comment">             *</span></div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;<span class="comment">             * These routines will convert the fields of &quot;frame&quot; from network to host byte order</span></div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;<span class="comment">             *</span></div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;<span class="comment">             * Currently nothing&#39;s done with valid packets, at some point an API for</span></div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;<span class="comment">             * querying these reports is implemented</span></div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;<span class="comment">             *</span></div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;<span class="comment">             * Return RTP_OK on success and RTP_ERROR on error */</span></div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;            rtp_error_t handle_sender_report_packet(uint8_t *frame, <span class="keywordtype">size_t</span> size);</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;            rtp_error_t handle_receiver_report_packet(uint8_t *frame, <span class="keywordtype">size_t</span> size);</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;            rtp_error_t handle_sdes_packet(uint8_t *frame, <span class="keywordtype">size_t</span> size);</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;            rtp_error_t handle_bye_packet(uint8_t *frame, <span class="keywordtype">size_t</span> size);</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;            rtp_error_t handle_app_packet(uint8_t *frame, <span class="keywordtype">size_t</span> size);</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160; </div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;            <span class="comment">/* Handle incoming RTCP packet (first make sure it&#39;s a valid RTCP packet)</span></div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;<span class="comment">             * This function will call one of the above functions internally</span></div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;<span class="comment">             *</span></div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;<span class="comment">             * Return RTP_OK on success and RTP_ERROR on error */</span></div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;            rtp_error_t handle_incoming_packet(uint8_t *buffer, <span class="keywordtype">size_t</span> size);</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160; </div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;            <span class="comment">/* Send &quot;frame&quot; to all participants</span></div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;<span class="comment">             *</span></div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;<span class="comment">             * These routines will convert all necessary fields to network byte order</span></div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;<span class="comment">             *</span></div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;<span class="comment">             * Return RTP_OK on success</span></div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;<span class="comment">             * Return RTP_INVALID_VALUE if &quot;frame&quot; is in some way invalid</span></div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;<span class="comment">             * Return RTP_SEND_ERROR if sending &quot;frame&quot; did not succeed (see socket.hh for details) */</span></div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160; </div>
<div class="line"><a name="l00133"></a><span class="lineno"><a class="line" href="classuvgrtp_1_1rtcp.html#aa7499b5ea9797a7a55727c3699dc7df6">  133</a></span>&#160;            rtp_error_t <a class="code" href="classuvgrtp_1_1rtcp.html#aa7499b5ea9797a7a55727c3699dc7df6">send_sdes_packet</a>(std::vector&lt;uvgrtp::frame::rtcp_sdes_item&gt;&amp; items);</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160; </div>
<div class="line"><a name="l00147"></a><span class="lineno"><a class="line" href="classuvgrtp_1_1rtcp.html#ad70c9ccdde9075e45a453f00591a522b">  147</a></span>&#160;            rtp_error_t <a class="code" href="classuvgrtp_1_1rtcp.html#ad70c9ccdde9075e45a453f00591a522b">send_app_packet</a>(<span class="keywordtype">char</span> *name, uint8_t subtype, <span class="keywordtype">size_t</span> payload_len, uint8_t *payload);</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160; </div>
<div class="line"><a name="l00163"></a><span class="lineno"><a class="line" href="classuvgrtp_1_1rtcp.html#a2b831698320212e382e3d565e62d31c4">  163</a></span>&#160;            rtp_error_t <a class="code" href="classuvgrtp_1_1rtcp.html#a2b831698320212e382e3d565e62d31c4">send_bye_packet</a>(std::vector&lt;uint32_t&gt; ssrcs);</div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160; </div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;            <span class="comment">/* Return the latest RTCP packet received from participant of &quot;ssrc&quot;</span></div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;<span class="comment">             * Return nullptr if we haven&#39;t received this kind of packet or if &quot;ssrc&quot; doesn&#39;t exist</span></div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;<span class="comment">             *</span></div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;<span class="comment">             * NOTE: Caller is responsible for deallocating the memory */</span></div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;            uvgrtp::frame::rtcp_sender_report   *get_sender_packet(uint32_t ssrc);</div>
<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;            uvgrtp::frame::rtcp_receiver_report *get_receiver_packet(uint32_t ssrc);</div>
<div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;            uvgrtp::frame::rtcp_sdes_packet     *get_sdes_packet(uint32_t ssrc);</div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;            uvgrtp::frame::rtcp_app_packet      *get_app_packet(uint32_t ssrc);</div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160; </div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;            <span class="comment">/* Return a reference to vector that contains the sockets of all participants */</span></div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;            std::vector&lt;uvgrtp::socket&gt;&amp; get_sockets();</div>
<div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160; </div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;            <span class="comment">/* Somebody joined the multicast group the owner of this RTCP instance is part of</span></div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;<span class="comment">             * Add it to RTCP participant list so we can start listening for reports</span></div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;<span class="comment">             *</span></div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;<span class="comment">             * &quot;clock_rate&quot; tells how much the RTP timestamp advances, this information is needed</span></div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;<span class="comment">             * to calculate the interarrival jitter correctly. It has nothing do with our clock rate,</span></div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;<span class="comment">             * (or whether we&#39;re even sending anything)</span></div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;<span class="comment">             *</span></div>
<div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;<span class="comment">             * Return RTP_OK on success and RTP_ERROR on error */</span></div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;            rtp_error_t add_participant(std::string dst_addr, uint16_t dst_port, uint16_t src_port, uint32_t clock_rate);</div>
<div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160; </div>
<div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;            <span class="comment">/* Functions for updating various RTP sender statistics */</span></div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;            <span class="keywordtype">void</span> sender_inc_seq_cycle_count();</div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;            <span class="keywordtype">void</span> sender_inc_sent_pkts(<span class="keywordtype">size_t</span> n);</div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;            <span class="keywordtype">void</span> sender_inc_sent_bytes(<span class="keywordtype">size_t</span> n);</div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;            <span class="keywordtype">void</span> sender_update_stats(uvgrtp::frame::rtp_frame *frame);</div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160; </div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;            <span class="keywordtype">void</span> receiver_inc_sent_bytes(uint32_t sender_ssrc, <span class="keywordtype">size_t</span> n);</div>
<div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;            <span class="keywordtype">void</span> receiver_inc_overhead_bytes(uint32_t sender_ssrc, <span class="keywordtype">size_t</span> n);</div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;            <span class="keywordtype">void</span> receiver_inc_total_bytes(uint32_t sender_ssrc, <span class="keywordtype">size_t</span> n);</div>
<div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;            <span class="keywordtype">void</span> receiver_inc_sent_pkts(uint32_t sender_ssrc, <span class="keywordtype">size_t</span> n);</div>
<div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160; </div>
<div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;            <span class="comment">/* Update the RTCP statistics regarding this packet</span></div>
<div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;<span class="comment">             *</span></div>
<div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;<span class="comment">             * Return RTP_OK if packet is valid</span></div>
<div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;<span class="comment">             * Return RTP_INVALID_VALUE if SSRCs of remotes have collided or the packet is invalid in some way</span></div>
<div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;<span class="comment">             * return RTP_SSRC_COLLISION if our own SSRC has collided and we need to reinitialize it */</span></div>
<div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;            rtp_error_t receiver_update_stats(uvgrtp::frame::rtp_frame *frame);</div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160; </div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;            <span class="comment">/* If we&#39;ve detected that our SSRC has collided with someone else&#39;s SSRC, we need to</span></div>
<div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;<span class="comment">             * generate new random SSRC and reinitialize our own RTCP state.</span></div>
<div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;<span class="comment">             * RTCP object still has the participants of &quot;last session&quot;, we can use their SSRCs</span></div>
<div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;<span class="comment">             * to detected new collision</span></div>
<div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;<span class="comment">             *</span></div>
<div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;<span class="comment">             * Return RTP_OK if reinitialization succeeded</span></div>
<div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;<span class="comment">             * Return RTP_SSRC_COLLISION if our new SSRC has collided and we need to generate new SSRC */</span></div>
<div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;            rtp_error_t reset_rtcp_state(uint32_t ssrc);</div>
<div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160; </div>
<div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;            <span class="comment">/* Update various session statistics */</span></div>
<div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;            <span class="keywordtype">void</span> update_session_statistics(uvgrtp::frame::rtp_frame *frame);</div>
<div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160; </div>
<div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;            <span class="comment">/* Return SSRCs of all participants */</span></div>
<div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;            std::vector&lt;uint32_t&gt; get_participants();</div>
<div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160; </div>
<div class="line"><a name="l00236"></a><span class="lineno"><a class="line" href="classuvgrtp_1_1rtcp.html#a5d0d06f9b4b7779d96d8d60938627316">  236</a></span>&#160;            <span class="keywordtype">void</span> <a class="code" href="classuvgrtp_1_1rtcp.html#a5d0d06f9b4b7779d96d8d60938627316">set_ts_info</a>(uint64_t clock_start, uint32_t clock_rate, uint32_t rtp_ts_start);</div>
<div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160; </div>
<div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;            <span class="comment">/* Alternate way to get RTCP packets is to install a hook for them. So instead of</span></div>
<div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;<span class="comment">             * polling an RTCP packet, user can install a function that is called when</span></div>
<div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;<span class="comment">             * a specific RTCP packet is received. */</span></div>
<div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160; </div>
<div class="line"><a name="l00252"></a><span class="lineno"><a class="line" href="classuvgrtp_1_1rtcp.html#a4a262a814ffa3093ac6829c90b0b3fd1">  252</a></span>&#160;            rtp_error_t <a class="code" href="classuvgrtp_1_1rtcp.html#a4a262a814ffa3093ac6829c90b0b3fd1">install_sender_hook</a>(<span class="keywordtype">void</span> (*hook)(uvgrtp::frame::rtcp_sender_report *));</div>
<div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160; </div>
<div class="line"><a name="l00264"></a><span class="lineno"><a class="line" href="classuvgrtp_1_1rtcp.html#a04c887fe95173d55294f57d639a1f602">  264</a></span>&#160;            rtp_error_t <a class="code" href="classuvgrtp_1_1rtcp.html#a04c887fe95173d55294f57d639a1f602">install_receiver_hook</a>(<span class="keywordtype">void</span> (*hook)(uvgrtp::frame::rtcp_receiver_report *));</div>
<div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160; </div>
<div class="line"><a name="l00276"></a><span class="lineno"><a class="line" href="classuvgrtp_1_1rtcp.html#ad694a3a869b1c28309e1f2db6d7c2e50">  276</a></span>&#160;            rtp_error_t <a class="code" href="classuvgrtp_1_1rtcp.html#ad694a3a869b1c28309e1f2db6d7c2e50">install_sdes_hook</a>(<span class="keywordtype">void</span> (*hook)(uvgrtp::frame::rtcp_sdes_packet *));</div>
<div class="line"><a name="l00277"></a><span class="lineno">  277</span>&#160; </div>
<div class="line"><a name="l00288"></a><span class="lineno"><a class="line" href="classuvgrtp_1_1rtcp.html#a977c99cfaa1442553ab12d4c140bbb0f">  288</a></span>&#160;            rtp_error_t <a class="code" href="classuvgrtp_1_1rtcp.html#a977c99cfaa1442553ab12d4c140bbb0f">install_app_hook</a>(<span class="keywordtype">void</span> (*hook)(uvgrtp::frame::rtcp_app_packet *));</div>
<div class="line"><a name="l00289"></a><span class="lineno">  289</span>&#160; </div>
<div class="line"><a name="l00291"></a><span class="lineno">  291</span>&#160;            <span class="comment">/* Update RTCP-related sender statistics */</span></div>
<div class="line"><a name="l00292"></a><span class="lineno">  292</span>&#160;            rtp_error_t update_sender_stats(<span class="keywordtype">size_t</span> pkt_size);</div>
<div class="line"><a name="l00293"></a><span class="lineno">  293</span>&#160; </div>
<div class="line"><a name="l00294"></a><span class="lineno">  294</span>&#160;            <span class="comment">/* Update RTCP-related receiver statistics */</span></div>
<div class="line"><a name="l00295"></a><span class="lineno">  295</span>&#160;            <span class="keyword">static</span> rtp_error_t recv_packet_handler(<span class="keywordtype">void</span> *arg, <span class="keywordtype">int</span> flags, frame::rtp_frame **out);</div>
<div class="line"><a name="l00296"></a><span class="lineno">  296</span>&#160; </div>
<div class="line"><a name="l00297"></a><span class="lineno">  297</span>&#160;            <span class="comment">/* Update RTCP-related sender statistics */</span></div>
<div class="line"><a name="l00298"></a><span class="lineno">  298</span>&#160;            <span class="keyword">static</span> rtp_error_t send_packet_handler_vec(<span class="keywordtype">void</span> *arg, uvgrtp::buf_vec&amp; buffers);</div>
<div class="line"><a name="l00300"></a><span class="lineno">  300</span>&#160; </div>
<div class="line"><a name="l00301"></a><span class="lineno">  301</span>&#160;        <span class="keyword">private</span>:</div>
<div class="line"><a name="l00302"></a><span class="lineno">  302</span>&#160;            <span class="keyword">static</span> <span class="keywordtype">void</span> rtcp_runner(<a class="code" href="classuvgrtp_1_1rtcp.html">rtcp</a> *<a class="code" href="classuvgrtp_1_1rtcp.html">rtcp</a>);</div>
<div class="line"><a name="l00303"></a><span class="lineno">  303</span>&#160; </div>
<div class="line"><a name="l00304"></a><span class="lineno">  304</span>&#160;            <span class="comment">/* when we start the RTCP instance, we don&#39;t know what the SSRC of the remote is</span></div>
<div class="line"><a name="l00305"></a><span class="lineno">  305</span>&#160;<span class="comment">             * when an RTP packet is received, we must check if we&#39;ve already received a packet</span></div>
<div class="line"><a name="l00306"></a><span class="lineno">  306</span>&#160;<span class="comment">             * from this sender and if not, create new entry to receiver_stats_ map */</span></div>
<div class="line"><a name="l00307"></a><span class="lineno">  307</span>&#160;            <span class="keywordtype">bool</span> is_participant(uint32_t ssrc);</div>
<div class="line"><a name="l00308"></a><span class="lineno">  308</span>&#160; </div>
<div class="line"><a name="l00309"></a><span class="lineno">  309</span>&#160;            <span class="comment">/* When we receive an RTP or RTCP packet, we need to check the source address and see if it&#39;s</span></div>
<div class="line"><a name="l00310"></a><span class="lineno">  310</span>&#160;<span class="comment">             * the same address where we&#39;ve received packets before.</span></div>
<div class="line"><a name="l00311"></a><span class="lineno">  311</span>&#160;<span class="comment">             *</span></div>
<div class="line"><a name="l00312"></a><span class="lineno">  312</span>&#160;<span class="comment">             * If the address is new, it means we have detected an SSRC collision and the paket should</span></div>
<div class="line"><a name="l00313"></a><span class="lineno">  313</span>&#160;<span class="comment">             * be dropped We also need to check whether this SSRC matches with our own SSRC and if it does</span></div>
<div class="line"><a name="l00314"></a><span class="lineno">  314</span>&#160;<span class="comment">             * we need to send RTCP BYE and rejoin to the session */</span></div>
<div class="line"><a name="l00315"></a><span class="lineno">  315</span>&#160;            <span class="keywordtype">bool</span> collision_detected(uint32_t ssrc, sockaddr_in&amp; src_addr);</div>
<div class="line"><a name="l00316"></a><span class="lineno">  316</span>&#160; </div>
<div class="line"><a name="l00317"></a><span class="lineno">  317</span>&#160;            <span class="comment">/* Move participant from initial_peers_ to participants_ */</span></div>
<div class="line"><a name="l00318"></a><span class="lineno">  318</span>&#160;            rtp_error_t add_participant(uint32_t ssrc);</div>
<div class="line"><a name="l00319"></a><span class="lineno">  319</span>&#160; </div>
<div class="line"><a name="l00320"></a><span class="lineno">  320</span>&#160;            <span class="comment">/* We&#39;ve got a message from new source (the SSRC of the frame is not known to us)</span></div>
<div class="line"><a name="l00321"></a><span class="lineno">  321</span>&#160;<span class="comment">             * Initialize statistics for the peer and move it to participants_ */</span></div>
<div class="line"><a name="l00322"></a><span class="lineno">  322</span>&#160;            rtp_error_t init_new_participant(uvgrtp::frame::rtp_frame *frame);</div>
<div class="line"><a name="l00323"></a><span class="lineno">  323</span>&#160; </div>
<div class="line"><a name="l00324"></a><span class="lineno">  324</span>&#160;            <span class="comment">/* Initialize the RTP Sequence related stuff of peer</span></div>
<div class="line"><a name="l00325"></a><span class="lineno">  325</span>&#160;<span class="comment">             * This function assumes that the peer already exists in the participants_ map */</span></div>
<div class="line"><a name="l00326"></a><span class="lineno">  326</span>&#160;            rtp_error_t init_participant_seq(uint32_t ssrc, uint16_t base_seq);</div>
<div class="line"><a name="l00327"></a><span class="lineno">  327</span>&#160; </div>
<div class="line"><a name="l00328"></a><span class="lineno">  328</span>&#160;            <span class="comment">/* Update the SSRC&#39;s sequence related data in participants_ map</span></div>
<div class="line"><a name="l00329"></a><span class="lineno">  329</span>&#160;<span class="comment">             *</span></div>
<div class="line"><a name="l00330"></a><span class="lineno">  330</span>&#160;<span class="comment">             * Return RTP_OK if the received packet was OK</span></div>
<div class="line"><a name="l00331"></a><span class="lineno">  331</span>&#160;<span class="comment">             * Return RTP_GENERIC_ERROR if it wasn&#39;t and</span></div>
<div class="line"><a name="l00332"></a><span class="lineno">  332</span>&#160;<span class="comment">             * packet-related statistics should not be updated */</span></div>
<div class="line"><a name="l00333"></a><span class="lineno">  333</span>&#160;            rtp_error_t update_participant_seq(uint32_t ssrc, uint16_t seq);</div>
<div class="line"><a name="l00334"></a><span class="lineno">  334</span>&#160; </div>
<div class="line"><a name="l00335"></a><span class="lineno">  335</span>&#160;            <span class="comment">/* Update the RTCP bandwidth variables</span></div>
<div class="line"><a name="l00336"></a><span class="lineno">  336</span>&#160;<span class="comment">             *</span></div>
<div class="line"><a name="l00337"></a><span class="lineno">  337</span>&#160;<span class="comment">             * &quot;pkt_size&quot; tells how much rtcp_byte_count_</span></div>
<div class="line"><a name="l00338"></a><span class="lineno">  338</span>&#160;<span class="comment">             * should be increased before calculating the new average */</span></div>
<div class="line"><a name="l00339"></a><span class="lineno">  339</span>&#160;            <span class="keywordtype">void</span> update_rtcp_bandwidth(<span class="keywordtype">size_t</span> pkt_size);</div>
<div class="line"><a name="l00340"></a><span class="lineno">  340</span>&#160; </div>
<div class="line"><a name="l00341"></a><span class="lineno">  341</span>&#160;            <span class="comment">/* Functions for generating different kinds of reports.</span></div>
<div class="line"><a name="l00342"></a><span class="lineno">  342</span>&#160;<span class="comment">             * These functions will both generate the report and send it</span></div>
<div class="line"><a name="l00343"></a><span class="lineno">  343</span>&#160;<span class="comment">             *</span></div>
<div class="line"><a name="l00344"></a><span class="lineno">  344</span>&#160;<span class="comment">             * Return RTP_OK on success and RTP_ERROR on error */</span></div>
<div class="line"><a name="l00345"></a><span class="lineno">  345</span>&#160;            rtp_error_t generate_sender_report();</div>
<div class="line"><a name="l00346"></a><span class="lineno">  346</span>&#160;            rtp_error_t generate_receiver_report();</div>
<div class="line"><a name="l00347"></a><span class="lineno">  347</span>&#160; </div>
<div class="line"><a name="l00348"></a><span class="lineno">  348</span>&#160;            <span class="comment">/* Because struct statistics contains uvgRTP clock object we cannot</span></div>
<div class="line"><a name="l00349"></a><span class="lineno">  349</span>&#160;<span class="comment">             * zero it out without compiler complaining about it so all the fields</span></div>
<div class="line"><a name="l00350"></a><span class="lineno">  350</span>&#160;<span class="comment">             * must be set to zero manually */</span></div>
<div class="line"><a name="l00351"></a><span class="lineno">  351</span>&#160;            <span class="keywordtype">void</span> zero_stats(uvgrtp::rtcp_statistics *stats);</div>
<div class="line"><a name="l00352"></a><span class="lineno">  352</span>&#160; </div>
<div class="line"><a name="l00353"></a><span class="lineno">  353</span>&#160;            <span class="comment">/* Pointer to RTP context from which clock rate etc. info is collected and which is</span></div>
<div class="line"><a name="l00354"></a><span class="lineno">  354</span>&#160;<span class="comment">             * used to change SSRC if a collision is detected */</span></div>
<div class="line"><a name="l00355"></a><span class="lineno">  355</span>&#160;            uvgrtp::rtp *rtp_;</div>
<div class="line"><a name="l00356"></a><span class="lineno">  356</span>&#160; </div>
<div class="line"><a name="l00357"></a><span class="lineno">  357</span>&#160;            <span class="comment">/* Secure RTCP context */</span></div>
<div class="line"><a name="l00358"></a><span class="lineno">  358</span>&#160;            uvgrtp::srtcp *srtcp_;</div>
<div class="line"><a name="l00359"></a><span class="lineno">  359</span>&#160; </div>
<div class="line"><a name="l00360"></a><span class="lineno">  360</span>&#160;            <span class="comment">/* RTP context flags */</span></div>
<div class="line"><a name="l00361"></a><span class="lineno">  361</span>&#160;            <span class="keywordtype">int</span> flags_;</div>
<div class="line"><a name="l00362"></a><span class="lineno">  362</span>&#160; </div>
<div class="line"><a name="l00363"></a><span class="lineno">  363</span>&#160;            <span class="comment">/* are we a sender or a receiver */</span></div>
<div class="line"><a name="l00364"></a><span class="lineno">  364</span>&#160;            <span class="keywordtype">int</span> our_role_;</div>
<div class="line"><a name="l00365"></a><span class="lineno">  365</span>&#160; </div>
<div class="line"><a name="l00366"></a><span class="lineno">  366</span>&#160;            <span class="comment">/* TODO: time_t?? */</span></div>
<div class="line"><a name="l00367"></a><span class="lineno">  367</span>&#160;            <span class="keywordtype">size_t</span> tp_;       <span class="comment">/* the last time an RTCP packet was transmitted */</span></div>
<div class="line"><a name="l00368"></a><span class="lineno">  368</span>&#160;            <span class="keywordtype">size_t</span> tc_;       <span class="comment">/* the current time */</span></div>
<div class="line"><a name="l00369"></a><span class="lineno">  369</span>&#160;            <span class="keywordtype">size_t</span> tn_;       <span class="comment">/* the next scheduled transmission time of an RTCP packet */</span></div>
<div class="line"><a name="l00370"></a><span class="lineno">  370</span>&#160;            <span class="keywordtype">size_t</span> pmembers_; <span class="comment">/* the estimated number of session members at the time tn was last recomputed */</span></div>
<div class="line"><a name="l00371"></a><span class="lineno">  371</span>&#160;            <span class="keywordtype">size_t</span> members_;  <span class="comment">/* the most current estimate for the number of session members */</span></div>
<div class="line"><a name="l00372"></a><span class="lineno">  372</span>&#160;            <span class="keywordtype">size_t</span> senders_;  <span class="comment">/* the most current estimate for the number of senders in the session */</span></div>
<div class="line"><a name="l00373"></a><span class="lineno">  373</span>&#160; </div>
<div class="line"><a name="l00374"></a><span class="lineno">  374</span>&#160;            <span class="comment">/* The target RTCP bandwidth, i.e., the total bandwidth</span></div>
<div class="line"><a name="l00375"></a><span class="lineno">  375</span>&#160;<span class="comment">             * that will be used for RTCP packets by all members of this session,</span></div>
<div class="line"><a name="l00376"></a><span class="lineno">  376</span>&#160;<span class="comment">             * in octets per second.  This will be a specified fraction of the</span></div>
<div class="line"><a name="l00377"></a><span class="lineno">  377</span>&#160;<span class="comment">             * &quot;session bandwidth&quot; parameter supplied to the application at startup. */</span></div>
<div class="line"><a name="l00378"></a><span class="lineno">  378</span>&#160;            <span class="keywordtype">size_t</span> rtcp_bandwidth_;</div>
<div class="line"><a name="l00379"></a><span class="lineno">  379</span>&#160; </div>
<div class="line"><a name="l00380"></a><span class="lineno">  380</span>&#160;            <span class="comment">/* Flag that is true if the application has sent data since</span></div>
<div class="line"><a name="l00381"></a><span class="lineno">  381</span>&#160;<span class="comment">             * the 2nd previous RTCP report was transmitted. */</span></div>
<div class="line"><a name="l00382"></a><span class="lineno">  382</span>&#160;            <span class="keywordtype">bool</span> we_sent_;</div>
<div class="line"><a name="l00383"></a><span class="lineno">  383</span>&#160; </div>
<div class="line"><a name="l00384"></a><span class="lineno">  384</span>&#160;            <span class="comment">/* The average compound RTCP packet size, in octets,</span></div>
<div class="line"><a name="l00385"></a><span class="lineno">  385</span>&#160;<span class="comment">             * over all RTCP packets sent and received by this participant. The</span></div>
<div class="line"><a name="l00386"></a><span class="lineno">  386</span>&#160;<span class="comment">             * size includes lower-layer transport and network protocol headers</span></div>
<div class="line"><a name="l00387"></a><span class="lineno">  387</span>&#160;<span class="comment">             * (e.g., UDP and IP) as explained in Section 6.2 */</span></div>
<div class="line"><a name="l00388"></a><span class="lineno">  388</span>&#160;            <span class="keywordtype">size_t</span> avg_rtcp_pkt_pize_;</div>
<div class="line"><a name="l00389"></a><span class="lineno">  389</span>&#160; </div>
<div class="line"><a name="l00390"></a><span class="lineno">  390</span>&#160;            <span class="comment">/* Number of RTCP packets and bytes sent and received by this participant */</span></div>
<div class="line"><a name="l00391"></a><span class="lineno">  391</span>&#160;            <span class="keywordtype">size_t</span> rtcp_pkt_count_;</div>
<div class="line"><a name="l00392"></a><span class="lineno">  392</span>&#160;            <span class="keywordtype">size_t</span> rtcp_byte_count_;</div>
<div class="line"><a name="l00393"></a><span class="lineno">  393</span>&#160; </div>
<div class="line"><a name="l00394"></a><span class="lineno">  394</span>&#160;            <span class="comment">/* Number of RTCP packets sent */</span></div>
<div class="line"><a name="l00395"></a><span class="lineno">  395</span>&#160;            <span class="keywordtype">size_t</span> rtcp_pkt_sent_count_;</div>
<div class="line"><a name="l00396"></a><span class="lineno">  396</span>&#160; </div>
<div class="line"><a name="l00397"></a><span class="lineno">  397</span>&#160;            <span class="comment">/* Flag that is true if the application has not yet sent an RTCP packet. */</span></div>
<div class="line"><a name="l00398"></a><span class="lineno">  398</span>&#160;            <span class="keywordtype">bool</span> initial_;</div>
<div class="line"><a name="l00399"></a><span class="lineno">  399</span>&#160; </div>
<div class="line"><a name="l00400"></a><span class="lineno">  400</span>&#160;            <span class="comment">/* Copy of our own current SSRC */</span></div>
<div class="line"><a name="l00401"></a><span class="lineno">  401</span>&#160;            uint32_t ssrc_;</div>
<div class="line"><a name="l00402"></a><span class="lineno">  402</span>&#160; </div>
<div class="line"><a name="l00403"></a><span class="lineno">  403</span>&#160;            <span class="comment">/* NTP timestamp associated with initial RTP timestamp (aka t = 0) */</span></div>
<div class="line"><a name="l00404"></a><span class="lineno">  404</span>&#160;            uint64_t clock_start_;</div>
<div class="line"><a name="l00405"></a><span class="lineno">  405</span>&#160; </div>
<div class="line"><a name="l00406"></a><span class="lineno">  406</span>&#160;            <span class="comment">/* Clock rate of the media ie. how fast does the time increase */</span></div>
<div class="line"><a name="l00407"></a><span class="lineno">  407</span>&#160;            uint32_t clock_rate_;</div>
<div class="line"><a name="l00408"></a><span class="lineno">  408</span>&#160; </div>
<div class="line"><a name="l00409"></a><span class="lineno">  409</span>&#160;            <span class="comment">/* The first value of RTP timestamp (aka t = 0) */</span></div>
<div class="line"><a name="l00410"></a><span class="lineno">  410</span>&#160;            uint32_t rtp_ts_start_;</div>
<div class="line"><a name="l00411"></a><span class="lineno">  411</span>&#160; </div>
<div class="line"><a name="l00412"></a><span class="lineno">  412</span>&#160;            std::map&lt;uint32_t, rtcp_participant *&gt; participants_;</div>
<div class="line"><a name="l00413"></a><span class="lineno">  413</span>&#160;            <span class="keywordtype">size_t</span> num_receivers_;</div>
<div class="line"><a name="l00414"></a><span class="lineno">  414</span>&#160; </div>
<div class="line"><a name="l00415"></a><span class="lineno">  415</span>&#160;            <span class="comment">/* statistics for RTCP Sender and Receiver Reports */</span></div>
<div class="line"><a name="l00416"></a><span class="lineno">  416</span>&#160;            <span class="keyword">struct </span>rtcp_statistics our_stats;</div>
<div class="line"><a name="l00417"></a><span class="lineno">  417</span>&#160; </div>
<div class="line"><a name="l00418"></a><span class="lineno">  418</span>&#160;            <span class="comment">/* If we expect frames from remote but haven&#39;t received anything from remote yet,</span></div>
<div class="line"><a name="l00419"></a><span class="lineno">  419</span>&#160;<span class="comment">             * the participant resides in this vector until he&#39;s moved to participants_ */</span></div>
<div class="line"><a name="l00420"></a><span class="lineno">  420</span>&#160;            std::vector&lt;rtcp_participant *&gt; initial_participants_;</div>
<div class="line"><a name="l00421"></a><span class="lineno">  421</span>&#160; </div>
<div class="line"><a name="l00422"></a><span class="lineno">  422</span>&#160;            <span class="comment">/* Vector of sockets the RTCP runner is listening to</span></div>
<div class="line"><a name="l00423"></a><span class="lineno">  423</span>&#160;<span class="comment">             *</span></div>
<div class="line"><a name="l00424"></a><span class="lineno">  424</span>&#160;<span class="comment">             * The socket are also stored here (in addition to participants_ map) so they&#39;re easier</span></div>
<div class="line"><a name="l00425"></a><span class="lineno">  425</span>&#160;<span class="comment">             * to pass to poll when RTCP runner is listening to incoming packets */</span></div>
<div class="line"><a name="l00426"></a><span class="lineno">  426</span>&#160;            std::vector&lt;uvgrtp::socket&gt; sockets_;</div>
<div class="line"><a name="l00427"></a><span class="lineno">  427</span>&#160; </div>
<div class="line"><a name="l00428"></a><span class="lineno">  428</span>&#160;            void (*sender_hook_)(uvgrtp::frame::rtcp_sender_report *);</div>
<div class="line"><a name="l00429"></a><span class="lineno">  429</span>&#160;            void (*receiver_hook_)(uvgrtp::frame::rtcp_receiver_report *);</div>
<div class="line"><a name="l00430"></a><span class="lineno">  430</span>&#160;            void (*sdes_hook_)(uvgrtp::frame::rtcp_sdes_packet *);</div>
<div class="line"><a name="l00431"></a><span class="lineno">  431</span>&#160;            void (*app_hook_)(uvgrtp::frame::rtcp_app_packet *);</div>
<div class="line"><a name="l00432"></a><span class="lineno">  432</span>&#160;    };</div>
<div class="line"><a name="l00433"></a><span class="lineno">  433</span>&#160;};</div>
<div class="line"><a name="l00434"></a><span class="lineno">  434</span>&#160; </div>
<div class="line"><a name="l00435"></a><span class="lineno">  435</span>&#160;<span class="keyword">namespace </span>uvg_rtp = uvgrtp;</div>
<div class="ttc" id="aclassuvgrtp_1_1rtcp_html"><div class="ttname"><a href="classuvgrtp_1_1rtcp.html">uvgrtp::rtcp</a></div><div class="ttdef"><b>Definition:</b> rtcp.hh:74</div></div>
<div class="ttc" id="aclassuvgrtp_1_1rtcp_html_a04c887fe95173d55294f57d639a1f602"><div class="ttname"><a href="classuvgrtp_1_1rtcp.html#a04c887fe95173d55294f57d639a1f602">uvgrtp::rtcp::install_receiver_hook</a></div><div class="ttdeci">rtp_error_t install_receiver_hook(void(*hook)(uvgrtp::frame::rtcp_receiver_report *))</div><div class="ttdoc">Install an RTCP Receiver Report hook.</div></div>
<div class="ttc" id="aclassuvgrtp_1_1rtcp_html_a2b831698320212e382e3d565e62d31c4"><div class="ttname"><a href="classuvgrtp_1_1rtcp.html#a2b831698320212e382e3d565e62d31c4">uvgrtp::rtcp::send_bye_packet</a></div><div class="ttdeci">rtp_error_t send_bye_packet(std::vector&lt; uint32_t &gt; ssrcs)</div><div class="ttdoc">Send an RTCP BYE packet.</div></div>
<div class="ttc" id="aclassuvgrtp_1_1rtcp_html_a4a262a814ffa3093ac6829c90b0b3fd1"><div class="ttname"><a href="classuvgrtp_1_1rtcp.html#a4a262a814ffa3093ac6829c90b0b3fd1">uvgrtp::rtcp::install_sender_hook</a></div><div class="ttdeci">rtp_error_t install_sender_hook(void(*hook)(uvgrtp::frame::rtcp_sender_report *))</div><div class="ttdoc">Install an RTCP Sender Report hook.</div></div>
<div class="ttc" id="aclassuvgrtp_1_1rtcp_html_a5d0d06f9b4b7779d96d8d60938627316"><div class="ttname"><a href="classuvgrtp_1_1rtcp.html#a5d0d06f9b4b7779d96d8d60938627316">uvgrtp::rtcp::set_ts_info</a></div><div class="ttdeci">void set_ts_info(uint64_t clock_start, uint32_t clock_rate, uint32_t rtp_ts_start)</div><div class="ttdoc">Provide timestamping information for RTCP.</div></div>
<div class="ttc" id="aclassuvgrtp_1_1rtcp_html_a977c99cfaa1442553ab12d4c140bbb0f"><div class="ttname"><a href="classuvgrtp_1_1rtcp.html#a977c99cfaa1442553ab12d4c140bbb0f">uvgrtp::rtcp::install_app_hook</a></div><div class="ttdeci">rtp_error_t install_app_hook(void(*hook)(uvgrtp::frame::rtcp_app_packet *))</div><div class="ttdoc">Install an RTCP APP packet hook.</div></div>
<div class="ttc" id="aclassuvgrtp_1_1rtcp_html_aa7499b5ea9797a7a55727c3699dc7df6"><div class="ttname"><a href="classuvgrtp_1_1rtcp.html#aa7499b5ea9797a7a55727c3699dc7df6">uvgrtp::rtcp::send_sdes_packet</a></div><div class="ttdeci">rtp_error_t send_sdes_packet(std::vector&lt; uvgrtp::frame::rtcp_sdes_item &gt; &amp;items)</div><div class="ttdoc">Send an RTCP SDES packet.</div></div>
<div class="ttc" id="aclassuvgrtp_1_1rtcp_html_ad694a3a869b1c28309e1f2db6d7c2e50"><div class="ttname"><a href="classuvgrtp_1_1rtcp.html#ad694a3a869b1c28309e1f2db6d7c2e50">uvgrtp::rtcp::install_sdes_hook</a></div><div class="ttdeci">rtp_error_t install_sdes_hook(void(*hook)(uvgrtp::frame::rtcp_sdes_packet *))</div><div class="ttdoc">Install an RTCP SDES packet hook.</div></div>
<div class="ttc" id="aclassuvgrtp_1_1rtcp_html_ad70c9ccdde9075e45a453f00591a522b"><div class="ttname"><a href="classuvgrtp_1_1rtcp.html#ad70c9ccdde9075e45a453f00591a522b">uvgrtp::rtcp::send_app_packet</a></div><div class="ttdeci">rtp_error_t send_app_packet(char *name, uint8_t subtype, size_t payload_len, uint8_t *payload)</div><div class="ttdoc">Send an RTCP APP packet.</div></div>
<div class="ttc" id="autil_8hh_html"><div class="ttname"><a href="util_8hh.html">util.hh</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
</small></address>
</body>
</html>
